class Solution {
public:
    vector<int> majorityElement(vector<int>& nums) {
        int n = nums.size();
        vector<int> ret;
        unordered_map<int, int> cnt;
        for (auto& e : nums)
        {
            cnt[e]++;
        }
        for (auto& e : cnt)
        {
            if (e.second > n / 3)
                ret.push_back(e.first);
        }
        return ret;
    }
};